package com.example.teacher.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;

public class DBUtil {
    public static Connection getConnection() throws Exception{
        Class.forName("com.mysql.cj.jdbc.Driver");
        Properties properties=new Properties();
        properties.load(DBUtil.class.getClassLoader().getResourceAsStream("/jdbc.properties"));
        String url=properties.getProperty("url");
        String username=properties.getProperty("username");
        String password=properties.getProperty("password");
        System.out.println(url);
        return DriverManager.getConnection(url,username,password);
    }

}
